var HeaderNav = Vue.component('header-nav', {
    props: {
        leftIcon: {
            type: String,
            default: ''
        },
        hasscan:{
            type:Boolean,
            default:false
        }
    },
    template: `
    <div class="ccb-navbar-top">
        <div class="ccb-navbar-layout">
            <div class="ccb-navbar-bank">
                <a href="###" @click.prevent="goBack" v-if="leftIcon=='back'" class="ccb-nav-icon">
                    <i class="fa fa-angle-double-left"></i>
                </a>
                <a href="index.html" v-if="leftIcon=='home'" class="ccb-nav-icon">
                    <i class="fa fa-home fa-2x"></i>
                </a>
                <a href="##" v-if="leftIcon==''" class="ccb-nav-icon ccb-icon-circle">
                    <img :src="url">
                </a>
            </div>
            <!-- <div class="ccb-navber-address"></div> -->
            <div class="ccb-navber-fun">
                <a href="javascript:void(0)" class="ccb-nav-icon">
                    <img src="./assets/ye.png"><span class="ccb-c-white ccb-fs-16">{{balance}}</span>
                </a>
                <a href="###" @click.prevent="openScan" class="ccb-nav-icon" v-if="hasscan">
                    <img src="./assets/ewm.png">
                </a>
            </div>
        </div>
    </div>
    `,
    data:function(){
        return {
            username:'菜菜帮欢迎您',
            balance:'',
            url:''
        }
    },
    methods: {
        goBack:function() {
            window.history.go(-1);
        },
        openScan(){
            this.$emit('openscan');
        },
    },
    mounted:function(){
        this.username = getStr(localStorage.username).length>0?'会员:'+getStr(localStorage.username):'菜菜帮欢迎您';
        this.balance = getNum(localStorage.balance).toFixed(2);
        this.url = (localStorage.url&&localStorage.url!=''&&localStorage.url!='null')?localStorage.url:'./assets/logo.jpg';
        
    }
});